///*
//package com.example.workrecord.util.dingtalkopenapi.message;
//
//import com.alibaba.fastjson.JSONObject;
//import com.dingtalk.api.DefaultDingTalkClient;
//import com.dingtalk.api.DingTalkClient;
//import com.dingtalk.api.request.OapiMessageCorpconversationAsyncsendV2Request;
//import com.dingtalk.api.response.OapiMessageCorpconversationAsyncsendV2Response;
//import com.example.workrecord.exption.BizException;
//import com.example.workrecord.system.openapi.dingtalkopenapi.utils.HttpUtil;
//import com.example.workrecord.util.DateUtils;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//
//import java.util.Map;
//
//*/
///**
// * 发送消息
// *//*
//
//public class MessageHelper {
//    private static final Logger logger=LoggerFactory.getLogger(MessageHelper.class);
//
//
//    public static void corpconversation(String access_token, String userId,String userName) throws Exception {
//        DingTalkClient client=new DefaultDingTalkClient("https://oapi.dingtalk.com/topapi/message/corpconversation/asyncsend_v2");
//        OapiMessageCorpconversationAsyncsendV2Request request=new OapiMessageCorpconversationAsyncsendV2Request();
//        request.setUseridList(userId);
//        request.setAgentId(589109094L);
//        request.setToAllUser(false);
//        OapiMessageCorpconversationAsyncsendV2Request.Msg msg=new OapiMessageCorpconversationAsyncsendV2Request.Msg();
//        StringBuffer sb=new StringBuffer();
//        String dayTime=DateUtils.getNowDay();
//        sb.append("亲，记得提醒"+userName+"请假哦(◕ᴗ◕)("+dayTime+")");
//        msg.setMsgtype("text");
//        msg.setText(new OapiMessageCorpconversationAsyncsendV2Request.Text());
//        msg.getText().setContent(sb.toString());
//        request.setMsg(msg);
//        OapiMessageCorpconversationAsyncsendV2Response response=client.execute(request, access_token);
//        if(!response.isSuccess()){
//            logger.info("工作通知无url创建失败：{}", response);
//        }
//
//    }
//
//    public static String sendImgMsg(String accessToken, Map msg) throws Exception {
//        String url="https://oapi.dingtalk.com/message/send?access_token=" + accessToken;
//        System.out.println(JSONObject.toJSONString(msg));
//        String jsonObject=HttpUtil.doPostObj(url, JSONObject.toJSONString(msg));
//        JSONObject obj=JSONObject.parseObject(jsonObject);
//        if (!"0".equals(obj.getString("errcode"))) {
//            logger.info("*************工作通知创建异常***********：{}", jsonObject);
//            throw new BizException("工作通知发送异常：" + obj.getString("errmsg"));
//        }
//        return jsonObject;
//    }
//
//
//    public static void sendMsgFail(String accseToken, String userId)  throws Exception {
//        DingTalkClient client=new DefaultDingTalkClient("https://oapi.dingtalk.com/topapi/message/corpconversation/asyncsend_v2");
//        OapiMessageCorpconversationAsyncsendV2Request request=new OapiMessageCorpconversationAsyncsendV2Request();
//        request.setUseridList(userId);
//        request.setAgentId(589109094L);
//        request.setToAllUser(false);
//        OapiMessageCorpconversationAsyncsendV2Request.Msg msg=new OapiMessageCorpconversationAsyncsendV2Request.Msg();
//        StringBuffer sb=new StringBuffer();
//        String dayTime=DateUtils.getNowDay();
//        sb.append("亲，记得打开GPS服务哦(◕ᴗ◕)("+dayTime+")");
//        msg.setMsgtype("text");
//        msg.setText(new OapiMessageCorpconversationAsyncsendV2Request.Text());
//        msg.getText().setContent(sb.toString());
//        request.setMsg(msg);
//        OapiMessageCorpconversationAsyncsendV2Response response=client.execute(request, accseToken);
//        if(!response.isSuccess()){
//            logger.info("工作通知无url创建失败：{}", response);
//        }
//
//    }
//
//    public static void corpconversationToPsn(String accseToken, String userId)  throws Exception {
//        DingTalkClient client=new DefaultDingTalkClient("https://oapi.dingtalk.com/topapi/message/corpconversation/asyncsend_v2");
//        OapiMessageCorpconversationAsyncsendV2Request request=new OapiMessageCorpconversationAsyncsendV2Request();
//        request.setUseridList(userId);
//        request.setAgentId(589109094L);
//        request.setToAllUser(false);
//        OapiMessageCorpconversationAsyncsendV2Request.Msg msg=new OapiMessageCorpconversationAsyncsendV2Request.Msg();
//        StringBuffer sb=new StringBuffer();
//        String dayTime=DateUtils.getNowDay();
//        sb.append("亲，记得请假哦(◕ᴗ◕)("+dayTime+")");
//        msg.setMsgtype("text");
//        msg.setText(new OapiMessageCorpconversationAsyncsendV2Request.Text());
//        msg.getText().setContent(sb.toString());
//        request.setMsg(msg);
//        OapiMessageCorpconversationAsyncsendV2Response response=client.execute(request, accseToken);
//        if(!response.isSuccess()){
//            logger.info("工作通知无url创建失败：{}", response);
//        }
//
//
//    }
//}
//*/
